package com.yhao.floatwindow;

import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Vibrator;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import com.lmiot.xyclick.Util.DataUtil;

public class FloatUtil {
    private static int Num = 0;
    public static boolean isControling = false;
    private static boolean isEdit = false;
    public static boolean isRepeat = false;
    public static boolean isShowPause = false;
    public static boolean isShowRecord = false;
    private static boolean isSwipe;
    private static boolean isTip;
    private static int redX;
    private static int redY;
    private static Point sPoint;
    private static Vibrator vibrator;

    public static void setSwipe(boolean z) {
        isSwipe = z;
    }

    public static boolean getSwipe() {
        return isSwipe;
    }

    static View inflate(Context context, int i) {
        return ((LayoutInflater) context.getSystemService("layout_inflater")).inflate(i, (ViewGroup) null);
    }

    static int getScreenWidth(Context context) {
        if (sPoint == null) {
            sPoint = new Point();
            ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getSize(sPoint);
        }
        return sPoint.x;
    }

    static int getScreenHeight(Context context) {
        if (sPoint == null) {
            sPoint = new Point();
            ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getSize(sPoint);
        }
        return sPoint.y;
    }

    static boolean isViewVisible(View view) {
        return view.getGlobalVisibleRect(new Rect());
    }

    public static void LongClick(Context context) {
        try {
            if (vibrator == null) {
                vibrator = (Vibrator) context.getSystemService("vibrator");
            }
            vibrator.vibrate(30);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void setViewXY(Context context, boolean z) {
        context.getSharedPreferences("DataUtil_1", 0).edit().putBoolean("setViewXY", z).commit();
    }

    public static boolean getViewXY(Context context) {
        return context.getSharedPreferences("DataUtil_1", 0).getBoolean("setViewXY", true);
    }

    public static void setFloatX(Context context, float f, String str) {
        SharedPreferences.Editor edit = context.getSharedPreferences("DataUtil_1", 0).edit();
        edit.putFloat("floatX" + str, f).commit();
    }

    public static float getFloatX(Context context, String str) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("DataUtil_1", 0);
        return sharedPreferences.getFloat("floatX" + str, (float) (((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth() / 2));
    }

    public static void setFloatY(Context context, float f, String str) {
        SharedPreferences.Editor edit = context.getSharedPreferences("DataUtil_1", 0).edit();
        edit.putFloat("floatY" + str, f).commit();
    }

    public static float getFloatY(Context context, String str) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("DataUtil_1", 0);
        return sharedPreferences.getFloat("floatY" + str, (float) ((((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight() / 2) + 200));
    }

    public static void setLockFloatView(Context context, boolean z) {
        context.getSharedPreferences("DataUtil_1", 0).edit().putBoolean("AutoWakeUp", z).commit();
    }

    public static boolean getLockFloatView(Context context) {
        return context.getSharedPreferences("DataUtil_1", 0).getBoolean("AutoWakeUp", false);
    }

    public static void setFront(Context context, boolean z) {
        context.getSharedPreferences("DataUtil_1", 0).edit().putBoolean("setFront", z).commit();
    }

    public static boolean getFront(Context context) {
        return context.getSharedPreferences("DataUtil_1", 0).getBoolean("setFront", false);
    }

    public static void setFirstShow(Context context, boolean z) {
        context.getSharedPreferences("DataUtil_1", 0).edit().putBoolean("setFirstShow", z).commit();
    }

    public static boolean getFirstShow(Context context) {
        return context.getSharedPreferences("DataUtil_1", 0).getBoolean("setFirstShow", true);
    }

    public static void setEdit(boolean z) {
        isEdit = z;
    }

    public static boolean getEdit() {
        return isEdit;
    }

    public static void setIsTip(boolean z) {
        isTip = z;
    }

    public static boolean getIsTip() {
        return isTip;
    }

    public static void setShowFlow(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setShowFlow", z).commit();
    }

    public static boolean getShowFlow(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setShowFlow", false);
    }

    public static void setShowFlowClick(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setShowFlowClick", z).commit();
    }

    public static boolean getShowFlowClick(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setShowFlowClick", false);
    }

    public static void setShowTrackClick(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setShowTrackClick", z).commit();
    }

    public static boolean getShowTrackClick(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setShowTrackClick", false);
    }

    public static void setShowFlowClickHand(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setShowFlowClickHand", z).commit();
    }

    public static boolean getShowFlowClickHand(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setShowFlowClickHand", true);
    }

    public static void setAutoMs(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setAutoMs", z).commit();
    }

    public static boolean getAutoMs(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setAutoMs", false);
    }

    public static void setAutoVibrate(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setAutoVibrate", z).commit();
    }

    public static boolean getAutoVibrate(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setAutoVibrate", true);
    }

    public static void setHideFloat(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setHideFloat", z).commit();
    }

    public static boolean getHideFloat(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setHideFloat", false);
    }

    public static void setHideRanDon(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setHideRanDon", z).commit();
    }

    public static boolean getHideRanDon(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setHideRanDon", true);
    }

    public static void setTopTip(Context context, int i) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putInt("setTopTipIntNs", i).commit();
    }

    public static int getTopTip(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getInt("setTopTipIntNs", 4);
    }

    public static void setClickView(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setClickView", z).commit();
    }

    public static boolean getClickView(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setClickView", true);
    }

    public static void setChangeData(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setChangeData", z).commit();
    }

    public static boolean getChangeData(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setChangeData", true);
    }

    public static void setTextLib(Context context, String str) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putString("setTextLib", str).commit();
    }

    public static String getTextLib(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getString("setTextLib", "[{\"text\":\"示范文本\"}]");
    }

    public static void setStopAuto(Context context, String str) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putString("setStopAuto", str).commit();
    }

    public static String getStopAuto(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getString("setStopAuto", DataUtil.KYE_LONG_VOLUEM_DES);
    }

    public static void setSlip(Context context, int i) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putInt("setSlip", i).commit();
    }

    public static int getSlip(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getInt("setSlip", 200);
    }

    public static void setClickTime(Context context, int i) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putInt("setClickTime", i).commit();
    }

    public static int getClickTime(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getInt("setClickTime", 10);
    }

    public static void setFloatPoint(Context context, int i) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putInt("setFloatPoint", i).commit();
    }

    public static int getFloatPoint(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getInt("setFloatPoint", 50);
    }

    public static void setShowPause(boolean z) {
        isShowPause = z;
    }

    public static boolean getShowPause() {
        return isShowPause;
    }

    public static void setKeep(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setKeep", z).commit();
    }

    public static boolean getKeep(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setKeep", false);
    }

    public static void setPauseCall(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setPauseCall", z).commit();
    }

    public static boolean getPauseCall(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setPauseCall", true);
    }

    public static void setRemote(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setRemote", z).commit();
    }

    public static boolean getRemote(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setRemote", true);
    }

    public static void setRemoteDoAuto(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setRemoteDoAuto", z).commit();
    }

    public static boolean getRemoteDoAuto(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setRemoteDoAuto", true);
    }

    public static void setRemoteDoLocal(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setRemoteDoLocal", z).commit();
    }

    public static boolean getRemoteDoLocal(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setRemoteDoLocal", true);
    }

    public static void setAutoShare(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setAutoShare", z).commit();
    }

    public static boolean getAutoShare(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setAutoShare", false);
    }

    public static void setLockStop(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setLockStop01", z).commit();
    }

    public static boolean getLockStop(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setLockStop01", true);
    }

    public static void setShowRecord(boolean z) {
        isShowRecord = z;
    }

    public static boolean getShowRecord() {
        return isShowRecord;
    }

    public static void setFloatJump(Context context, boolean z) {
        context.getSharedPreferences("VoiceData_1", 0).edit().putBoolean("setFloatJumpNew", z).commit();
    }

    public static boolean getFloatJump(Context context) {
        return context.getSharedPreferences("VoiceData_1", 0).getBoolean("setFloatJumpNew", false);
    }

    public static void setShowFlowClickPlus(Context context, int i, boolean z) {
        SharedPreferences.Editor edit = context.getSharedPreferences("VoiceData_1", 0).edit();
        edit.putBoolean("setShowFlowClickPlus" + i, z).commit();
    }

    public static boolean getShowFlowClickPlus(Context context, int i) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("VoiceData_1", 0);
        return sharedPreferences.getBoolean("setShowFlowClickPlus" + i, false);
    }
}